package groovy;

import groovy.text.markup.BaseTemplate;
import groovy.text.markup.MarkupTemplateEngine;
import groovy.text.markup.TemplateConfiguration;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

public abstract class WanglyTemplate extends BaseTemplate {
    private List<Function> functions;
    public WanglyTemplate(MarkupTemplateEngine templateEngine, Map model, Map<String, String> modelTypes, TemplateConfiguration configuration) {
        super(templateEngine, model, modelTypes, configuration);
        for (Function function : functions) {
            model.put(function.getClass().getName(),function);
        }
    }

    public void setFunctions(List<Function> functions) {
        this.functions = functions;
    }
    public void addFunctions(Function function) {
        this.functions.add(function);
    }
}
